#!/bin/bash

# Function to say hello
s1_hello() {
    echo "hello, world!"
}

# Function to display the current user name
s2_tell_who_i_am() {
    echo "$(whoami)"
}

# Function to determine and print the Linux distribution name
s3_which_distro_do_i_use() {
    source /etc/os-release && echo "${NAME}"
    # Or use the original command as it was less accurate but also works on many systems:
    # cat /etc/os-release | grep "NAME=" | sed 's/.*=\s*"\(.*\)"/\1/'
}

# Function to display the CPU architecture
s4_view_my_cpu_arch() {
    uname -m
}

# Function to display the size of the first SCSI disk (approximation, assuming size is in bytes)
s5_show_first_scsi_disk_size() {
    # This assumes disks starting with 'sd' are SCSI or SATA devices.
    # It gets the size in bytes and roughly converts to GB.
    # For exact size you might need to use other tools like 'df' or 'smartctl'
    SIZE_IN_BYTES=$(lsblk -l --output SIZE --noheadings --exclude 1 --regex '^sd[a-z]$' | head -n 1)
    SIZE_IN_GB=$((SIZE_IN_BYTES / 1024 / 1024 / 1024))
    echo "$SIZE_IN_GB"
}

# Function to display the total system memory size in megabytes
s6_show_main_memory_size_in_megabytes() {
    free -m | awk '/Mem:/ {print $2}'
}

# Call the functions as needed
s1_hello
s2_tell_who_i_am
s3_which_distro_do_i_use
s4_view_my_cpu_arch
s5_show_first_scsi_disk_size
s6_show_main_memory_size_in_megabytes
